﻿/**
 * Created by WU on 2016/9/7.
 */
$(function () {
    $('#form_regist').submit(function () {
        $.ajax({
            type:'post',
            url:'/register',
            data:$('#form_regist').serialize(),
            timeout:3000,
            dataType:'json',
            success:function (data) {
                if(data.res==1){
                    location.href='/article';
                }else if(data.res==0){
                    var nickname_info=$('#nickname_info');
                    nickname_info.text('该用户名/手机号已存在');
                    nickname_info.css({'color':'red','fontSize':'13px'});
                    $(this).select();
                    return false;
                }
            },
            error:function (error) {
                alert(error.message)

            }

        });
        return false;
    });

});